<?php 
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/
defined('_JEXEC') or die('Restricted access'); ?>
<script type="text/javascript" language="javascript">
//<![CDATA[

// Item must check not null
var arrCheck = new Array();

function submitbutton(pressbutton) {
	var form = document.adminForm;

	if (pressbutton == 'cancel') {
		submitform( pressbutton );
		return;
	}
	if ( pressbutton == 'save' || pressbutton == 'apply' ){
		if(form.FeedName.value == '' ){
		    alert('<?php echo JText::_('FEED NAME COULD NOT BE EMPTY')?>');
			form.FeedName.focus();
			return;
		}
		
		// Dynamic check data
		for(i=0; i < arrCheck.length; i++){
			if(typeof(arrCheck[i]) != 'undefined'){
				if(document.getElementById("field_id_"+i).value == "0"){
					alert("You must choose data for: '" + arrCheck[i] + "' tag in XML file.");
					document.getElementById("field_id_"+i).focus();
					return;
				}
			}
		}		
		
		submitform( pressbutton );
	}					
	else {
		submitform( pressbutton );
	}
}

//]]>
</script>
<form action="index.php" method="post" name="adminForm" id="adminForm">
<div class="col100">
	<?php echo $this->menu_User();?>
        	<br/>
	<fieldset class="adminform">
	
		<legend><?php echo JText::_( 'FEED INFO' ); ?></legend>

		<table class="admintable">
		<tr>
			<td width="100" align="right" class="key">
				<label for="SchemaID">
					<?php echo JText::_( 'XML SCHEMAS' ); ?>:
				</label>
			</td>
			<td>
				<?php echo $this->getSelectboxSchema($this->SchemaID);?>
			</td>
		</tr>
		<tr>
			<td width="100" align="right" class="key">
				<label for="FeedName">
					<?php echo JText::_( 'FEED NAME' ); ?>:<font color="Red">*</font>
				</label>
			</td>
			<td>
			<input type="text" name="FeedName" id="FeedName" size="50" value="<?php echo $this->data->FeedName;?>">
			</td>
		</tr>
		<tr>
			<td width="100" align="right" class="key">
				<label for="description">
					<?php echo JText::_( 'DESCRIPTION' ); ?>:
				</label>
			</td>
			<td>
			<textarea name="description" id="description" rows="4" cols="40"><?php echo $this->data->description;?></textarea>
			</td>
		</tr>
	</table>
	</fieldset>
	
	<fieldset class="adminform">
	
		<legend><?php echo JText::_( 'EXPORT OPTIONS' ); ?></legend>

		<table class="admintable">
		<tr>
			<td width="100" align="right" class="key">
				<label for="TotalRecords">
					<?php echo JText::_( 'MAX RECORDS' ); ?>:
				</label>
			</td>
			<td>
			<input type="text" name="TotalRecords" id="TotalRecords" size="10" value="<?php echo ($this->data->TotalRecords == null)?"0":$this->data->TotalRecords;?>">
			 (<?php echo JText::_('HOW MANY RECORDS TO PUT ON THE FEED AT ONE TIME, 0 : UNLIMITED'); ?>)
			</td>
		</tr>
		
		<tr>
			<td align="left" class="key" colspan="2"><div align="left"><?php echo JText::_('SPECIFY A FILTER FOR THIS FIELD'); ?> </div>
			</td>
		</tr>
		<tr>
			<td width="100" align="right" class="key">
				<label for="search_location">
					<?php echo JText::_( 'JOB LOCATION' ); ?>:
				</label>
			</td>
			<td>
			<?php echo $this->getComboboxData("search_location", "#__ja_location", $this->data->search_location);?>
			<!-- <input type="text" name="search_location" id="search_location" size="50" value="<?php echo $this->data->search_location;?>">
			<br/> <?php echo JText::_( 'USE COMMA FOR EACH LOCATION' ); ?> -->
			</td>
		</tr>
		<tr>
			<td width="100" align="right" class="key">
				<label for="search_category">
					<?php echo JText::_('JOB CATEGORY'); ?>:
				</label>
			</td>
			<td>
			<?php echo $this->getComboboxData("search_category[]", "#__ja_categories", $this->data->search_category, true);?>
			<!-- <input type="text" name="search_category" id="search_category" size="50" value="<?php echo $this->data->search_category;?>">
			<br/> <?php echo JText::_('USE COMMA FOR EACH CATEGORY'); ?> -->
			</td>
		</tr>
		<tr>
			<td width="100" align="right" class="key">
				<label for="search_type">
					<?php echo JText::_( 'JOB TYPE' ); ?>:
				</label>
			</td>
			<td>
			<?php echo $this->getSelectboxJobType($this->data->search_type);?>
			</td>
		</tr>
		<tr>
			<td width="100" align="right" class="key">
				<label for="search_title">
					<?php echo JText::_( 'JOB TITLE' ); ?>:
				</label>
			</td>
			<td>
			<input type="text" name="search_title" id="search_title" size="50" value="<?php echo $this->data->search_title;?>">
			</td>
		</tr>		
		<tr>
			<td width="100" align="right" class="key">
				<label for="search_description">
					<?php echo JText::_( 'DESCRIPTION' ); ?>:
				</label>
			</td>
			<td>
			<input type="text" name="search_description" id="search_description" size="50" value="<?php echo $this->data->search_description;?>">
			</td>
		</tr>
		
	</table>
	</fieldset>
	
	<fieldset class="adminform">
	
		<legend><?php echo JText::_( 'ASSOCIATE THE FIELDS FROM THE JA JOBBOARD FORM TO THE XML FEED' ); ?></legend>

		<table class="admintable" style="font-size:13px">		
		<tr>
			<td>
			<?php 
				global $elementInputOptions;
				$elementInputOptions = "FIELDS";
				$this->fcnBuildXMLDocumentTree($this->SchemaID);
			?>
			</td>
		</tr>
	</table>
	</fieldset>
	
</div>
<div class="clr"></div>

<input type="hidden" name="option" value="com_jajobboard" />
<input type="hidden" name="FeedID" value="<?php echo $this->data->FeedID;?>"/>
<input type="hidden" name="task" value="add"/>
<input type="hidden" name="tab" value="feeds" />
<input type="hidden" name="view" value="jaxmlexport" />
</form>